#include "CBase.h"
#include "../Wrappers\CSGD_Direct3D.h"
#include "../Wrappers\CSGD_DirectInput.h"
#include "../Wrappers\CSGD_FModManager.h"
#include "../Wrappers\CSGD_TextureManager.h"

CBase::CBase()
{

}
CBase::~CBase()
{
}
void CBase::Update(float _fDT)
{

}

void CBase::Render()
{
	CSGD_Direct3D* pD3D = CSGD_Direct3D::GetInstance();
	CSGD_TextureManager* pTM = CSGD_TextureManager::GetInstance();

	RECT imgRect = { 0, 0, m_nWidth, m_nHeight };
	pTM->Draw(m_nImageID, m_fPosX, m_fPosY, 1, 1, &imgRect);
}

void CBase::Release()
{
	m_unRefCount--;

	if (!m_unRefCount) 
		delete this; 
}

RECT CBase::GetCollisionRect()
{
	RECT temp = { GetPosX(), GetPosY(), GetPosX() + GetWidth(), GetPosY() + GetHeight()};
	return temp;
}

bool CBase::CheckCollision( IBaseInterface* pBase )
{
	RECT Temp;
	if(IntersectRect(&Temp, &this->GetCollisionRect(), &pBase->GetCollisionRect()))
	{
		return true;
	}
	else
		return false;
}
void CBase::HandleEvent(CEvent* pEvent)
{
}
